package com.newsnetwork.api.controller.admin;

import com.newsnetwork.grace.result.CommonJSONResult;
import com.newsnetwork.pojo.bo.AdminLoginBO;
import com.newsnetwork.pojo.bo.NewAdminBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author: HuangDekai
 * @date: 2022/11/7 10:41
 * @version: 1.0
 * @since: jdk8
 */
@Api(value = "管理员 admin 维护", tags = {"管理员 admin 维护的 Controller"})
@RequestMapping("adminMng")
public interface AdminMngControllerApi {

    @ApiOperation(value = "admin 登录方法接口", notes = "admin 登录方法接口", httpMethod = "POST")
    @PostMapping("/adminLogin")
    CommonJSONResult adminLogin(@RequestBody AdminLoginBO adminLoginBO,
                                HttpServletRequest request,
                                HttpServletResponse response);

    @ApiOperation(value = "查询 admin 用户名是否存在", notes = "查询 admin 用户名是否存在", httpMethod = "POST")
    @PostMapping("/adminIsExist")
    CommonJSONResult adminIsExist(@RequestParam String username,
                                HttpServletRequest request,
                                HttpServletResponse response);

    @ApiOperation(value = "创建 admin", notes = "创建 admin", httpMethod = "POST")
    @PostMapping("/addNewAdmin")
    CommonJSONResult addNewAdmin(@RequestBody NewAdminBO newAdminBO,
                                  HttpServletRequest request,
                                  HttpServletResponse response);
    @ApiOperation(value = "查询 admin 列表", notes = "查询 admin 列表", httpMethod = "POST")
    @PostMapping("/getAdminList")
    CommonJSONResult getAdminList(
            @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
            @RequestParam Integer page,
            @ApiParam(name = "pageSize", value = "分页查询每一页显示的条数", required = false)
            @RequestParam Integer pageSize);

    @ApiOperation(value = "退出登录 admin 管理员", notes = "退出登录 admin 管理员", httpMethod = "POST")
    @PostMapping("/adminLogout")
    CommonJSONResult adminLogout(@RequestParam String adminId,
                                 HttpServletRequest request,
                                 HttpServletResponse response);
}
